﻿using Microsoft.AspNetCore.Authorization;

namespace Service.Core.Identity.Model
{
    /// <summary>
    /// 必要参数类，
    /// 继承 IAuthorizationRequirement，用于设计自定义权限处理器PermissionHandler
    /// 因为AuthorizationHandler 中的泛型参数 TRequirement 必须继承 IAuthorizationRequirement
    /// </summary>
    public class PermissionRequirement : IAuthorizationRequirement
    {
        public PermissionRequirement(string claimType, TimeSpan expiration)
        {
            ClaimType = claimType;
            Expiration = expiration;
        }

        /// <summary>
        /// 用户权限集合
        /// </summary>
        public List<PermissionItem> Permissions { get; set; }

        /// <summary>
        /// 认证授权类型
        /// </summary>
        public string ClaimType { get; set; }


        /// <summary>
        /// 过期时间
        /// </summary>
        public TimeSpan Expiration { get; set; }



    }
}
